import Vue from 'vue'
import VueRouter from 'vue-router'
//引入login组件
import Login from '../components/Login.vue'
import ManHome from '../components/ManHome.vue'
import TeaHome from '../components/TeaHome.vue'
import Welcome from '../components/Welcome.vue'
import TWelcome from '../components/TWelcome.vue'
import SWelcome from '../components/SWelcome.vue'
import StudentList from '../components/manager/StudentList.vue'
import ClassList from '../components/manager/ClassList.vue'
import TeacherList from '../components/manager/TeacherList.vue'
import EssayList from '../components/manager/EssayList.vue'
import WorkList from '../components/teacher/WorkList.vue'
import TStudentList from '../components/teacher/StudentList.vue'
import TClassList from '../components/teacher/ClassList.vue'
import TEssayList from '../components/teacher/EssayList.vue'
import Index from '../components/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect:"/login"
  },
  {
    path: "/login",
    component: Index
  },
  {
    path:"/manhome",
    component:ManHome,
    redirect:"/welcome",
    children:[
      {path:"/welcome",component:Welcome},
      {path:"/studentlist",component:StudentList},
      {path:"/classlist",component:ClassList},
      {path:"/teacherlist",component:TeacherList},
      {path:"/essaylist",component:EssayList},
    ]
  },
  /*
  {
    path:"/teahome",
    component:TeaHome,
    redirect:"/twelcome",
    children:[
      {path:"/twelcome",component:TWelcome},
      {path:"/worklist",component:WorkList},
      {path:"/studentlist",component:TStudentList},
      {path:"/classlist",component:TClassList},
      {path:"/essaylist",component:TEssayList},
    ]
  },

  {
    path:"/stuhome",
    component:TeaHome,
    redirect:"/swelcome",
    children:[
      {path:"/swelcome",component:SWelcome},
      {path:"/worklist",component:WorkList},
      {path:"/essaylist",component:EssayList},
    ]
  },
  */
]

const router = new VueRouter({
  routes
})
//挂载路由导航守卫
/*router.beforeEach((to,from,next)=>{
if(to.path=='/login') return next();
const userFlag =window.sessionStorage.getItem("user");
if(!userFlag) next();
return next('/login')
})
*/
export default router
